package com.cm.caseManagement.service.impl;


import com.cm.caseManagement.dao.CmCaseIncomeMapper;
import com.cm.caseManagement.pojo.entity.CmCaseIncome;
import com.cm.caseManagement.service.ICmCaseIncomeService;
import com.cm.caseManagement.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 案件收支Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmCaseIncomeServiceImpl implements ICmCaseIncomeService
{
    @Autowired
    private CmCaseIncomeMapper cmCaseIncomeMapper;

    /**
     * 查询案件收支
     *
     * @param id 案件收支主键
     * @return 案件收支
     */
    @Override
    public CmCaseIncome selectCmCaseIncomeById(Long id)
    {
        return cmCaseIncomeMapper.selectCmCaseIncomeById(id);
    }

    /**
     * 查询案件收支列表
     *
     * @param cmCaseIncome 案件收支
     * @return 案件收支
     */
    @Override
    public List<CmCaseIncome> selectCmCaseIncomeList(CmCaseIncome cmCaseIncome)
    {
        return cmCaseIncomeMapper.selectCmCaseIncomeList(cmCaseIncome);
    }

    /**
     * 新增案件收支
     *
     * @param cmCaseIncome 案件收支
     * @return 结果
     */
    @Override
    public int insertCmCaseIncome(CmCaseIncome cmCaseIncome)
    {
        cmCaseIncome.setCreateTime(DateUtils.getNowDate());
        return cmCaseIncomeMapper.insertCmCaseIncome(cmCaseIncome);
    }

    /**
     * 修改案件收支
     *
     * @param cmCaseIncome 案件收支
     * @return 结果
     */
    @Override
    public int updateCmCaseIncome(CmCaseIncome cmCaseIncome)
    {
        cmCaseIncome.setUpdateTime(DateUtils.getNowDate());
        return cmCaseIncomeMapper.updateCmCaseIncome(cmCaseIncome);
    }

    /**
     * 批量删除案件收支
     *
     * @param ids 需要删除的案件收支主键
     * @return 结果
     */
    @Override
    public int deleteCmCaseIncomeByIds(Long[] ids)
    {
        return cmCaseIncomeMapper.deleteCmCaseIncomeByIds(ids);
    }

    /**
     * 删除案件收支信息
     *
     * @param id 案件收支主键
     * @return 结果
     */
    @Override
    public int deleteCmCaseIncomeById(Long id)
    {
        return cmCaseIncomeMapper.deleteCmCaseIncomeById(id);
    }
}
